package cn.edu.fzu.homemaking.api;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import cn.edu.fzu.homemaking.domain.enums.SexEnum;
import cn.edu.fzu.homemaking.domain.enums.StatusEnum;
import cn.edu.fzu.homemaking.web.Result;

@FeignClient(value = "sso")
public interface SsoApi {

    @RequestMapping("/api/auth/getInfo")
    void test();


    // 登录相关 ==================================================================================
    @GetMapping("/api/sso/isLogin")
    Result isLogin();


    @GetMapping("api/sso/index")
    Result loginIndex(@RequestParam("sessionId") String sessionId);


    @GetMapping("/api/sso/getSessionAttribute")
    Result getSession(@RequestParam("param") String param);


    @GetMapping("/api/sso/setSessionAttribute")
    Result setSession(@RequestParam("key") String key, @RequestParam("value") Object value);


    @GetMapping("/api/sso/logout")
    Result logout();
    // ==========================================================================================


    @GetMapping("/api/sso/auth/user/info")
    Result getUserInfo();


    @PostMapping("/api/sso/auth/user/addSysUser")
    Result addSysUser(@RequestParam("email") String email, @RequestParam("phone") String phone,
                      @RequestParam("address") String address, @RequestParam("faceUrl") String faceUrl,
                      @RequestParam("birth") String birth, @RequestParam("password") String password,
                      @RequestParam("sex") SexEnum sex, @RequestParam("name") String name);


    @PostMapping("/api/sso/auth/user/listCustomer")
    Result listCustomerUser(@RequestParam("email") String email, @RequestParam("name") String name,
                            @RequestParam("sex") SexEnum sex, @RequestParam("phone") String phone,
                            @RequestParam("status") StatusEnum status, @RequestParam("pageNum") Integer pageNum,
                            @RequestParam("pageSize") Integer pageSize);


    @PostMapping("/api/sso/auth/user/listSysUser")
    Result listSysUser(@RequestParam("email") String email, @RequestParam("name") String name,
                       @RequestParam("sex") SexEnum sex, @RequestParam("phone") String phone,
                       @RequestParam("status") StatusEnum status, @RequestParam("pageNum") Integer pageNum,
                       @RequestParam("pageSize") Integer pageSize);


    @PostMapping("/api/sso/auth/user/updateCustomerStatus")
    Result updateCustomerStatus(@RequestParam("email") String email, @RequestParam("status") StatusEnum status);


    @PostMapping("/api/sso/auth/user/updateSysUser")
    Result updateSysUser(@RequestParam("id") Long id, @RequestParam("email") String email, @RequestParam("phone") String phone,
                         @RequestParam("address") String address, @RequestParam("faceUrl") String faceUrl,
                         @RequestParam("status") StatusEnum status);

    @GetMapping("/api/sso/auth/user/countUser")
    Result countUser();
}
